<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <base target="_self">
    <script type="text/javascript" src="${path}/js/basic.js"></script>
    <link rel="stylesheet" type="text/css" href="${path}/css/public.css" />
    <link rel="stylesheet" href="${path}/js/themes/base/jquery.ui.all.css">
    <script type="text/javascript" src="${path}/js/jquery-1.7.2.js"></script>

    <script type="text/javascript" src="${path}/js/jquery.ui.core.js"></script>
    <script type="text/javascript" src="${path}/js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript" src="${path}/js/jquery.ui.datepicker-zh-CN.js"></script>
    <style type="text/css">
        .mytable {
            width: 60%;
        }

        .mytable td {
            width: 200px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#update_dept_deptName").blur(function () {
                if($(this).val()=="" || $("#bm").val()=="-1"){
                    $("#update_0").attr("disabled","disabled");
                }else{
                    $("#update_0").removeAttr("disabled");
                }
            });

            $("#bm").change(function () {
                if($(this).val()=="-1" || $("#update_dept_deptName").val()==""){
                    $("#update_0").attr("disabled","disabled");
                }else{
                    $("#update_0").removeAttr("disabled");
                }
            });

            $("#update_0").click(function () {
                window.close();
            });
        });
    </script>
</head>

<body>
<!-- 中部DIV -->
<div class="content">
    <div class="pageHead">
        <table>
            <tr>
                <th width="8"><img src="${path}/images/c_l.gif" height="31" width="8" /></th>
                <th align="left" class="title_area">当前位置： 更新部门信息</th>
                <th width="9"><img src="${path}/images/c_r.gif" height="31" width="9"></th>
            </tr>
        </table>
    </div>

    <div class="pageBody">
        <form id="update" name="update" action="${path}/dept/update.do" method="post">

            <div class="pageBody">
                <div class="customerDiv">
                    <table>
                        <input type="hidden" name="deptId" value="${department.id}" id="update_dept_id"/>
                        <input type="hidden" name="deptVersion" value="0" id="update_dept_version"/>
                        <tr>
                            <th>部门名称</th>
                            <td><input type="text" name="deptDeptName" value="${department.deptName}" id="update_dept_deptName"/></td>
                        </tr>

                        <tr>
                            <th>描述</th>
                            <td><input type="text" name="deptRemark" value="${department.remark}" id="update_dept_remark"/></td>
                        </tr>
                        <tr>
                            <th>父部门</th>
                            <!-- TODO -->
                            <td>
                                <select name="parentId" id="bm">
                                    <option value="-1">--请选择部门--</option>
                                    <c:if test="${empty departments}" var="b">no dept</c:if>
                                    <c:if test="${!b}">
                                        <c:forEach items="${departments}" var="dept">
                                            <option value="${dept.id}" <c:if test="${department.parent.id==dept.id}">selected="selected"</c:if> >${dept.deptName}</option>
                                        </c:forEach>
                                    </c:if>
                                </select>
                            </td>
                        </tr>
                    </table>

                    <div class="buttonBar">
                        <input type="submit" id="update_0" value="保存" class="mybutton"/>
                    </div>

                </div>
            </div>
        </form>

    </div>
</div>
</body>
</html>
